/*  1:   */ package org.intellij.lang.regexp.psi.impl;
/*  2:   */ 
/*  3:   */

import com.intellij.lang.ASTNode;
import org.intellij.lang.regexp.RegExpElementTypes;
import org.intellij.lang.regexp.RegExpTT;
import org.intellij.lang.regexp.psi.RegExpElementVisitor;
import org.intellij.lang.regexp.psi.RegExpGroup;
import org.intellij.lang.regexp.psi.RegExpPattern;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */ 
/* 10:   */ public class RegExpGroupImpl
/* 11:   */   extends RegExpElementImpl
/* 12:   */   implements RegExpGroup
/* 13:   */ {
/* 14:   */   public RegExpGroupImpl(ASTNode paramASTNode)
/* 15:   */   {
/* 16:28 */     super(paramASTNode);
/* 17:   */   }
/* 18:   */   
/* 19:   */   public void accept(RegExpElementVisitor paramRegExpElementVisitor)
/* 20:   */   {
/* 21:32 */     paramRegExpElementVisitor.visitRegExpGroup(this);
/* 22:   */   }
/* 23:   */   
/* 24:   */   public boolean isCapturing()
/* 25:   */   {
/* 26:36 */     ASTNode localASTNode = getNode().getFirstChildNode();
/* 27:37 */     return (localASTNode != null) && (localASTNode.getElementType() == RegExpTT.GROUP_BEGIN);
/* 28:   */   }
/* 29:   */   
/* 30:   */   public boolean isSimple()
/* 31:   */   {
/* 32:41 */     ASTNode localASTNode = getNode().getFirstChildNode();
/* 33:42 */     return (localASTNode != null) && ((localASTNode.getElementType() == RegExpTT.GROUP_BEGIN) || (localASTNode.getElementType() == RegExpTT.NON_CAPT_GROUP));
/* 34:   */   }
/* 35:   */   
/* 36:   */   public RegExpPattern getPattern()
/* 37:   */   {
/* 38:46 */     ASTNode localASTNode = getNode().findChildByType(RegExpElementTypes.PATTERN);
/* 39:47 */     return localASTNode != null ? (RegExpPattern)localASTNode.getPsi() : null;
/* 40:   */   }
/* 41:   */   
/* 42:   */   public boolean isPythonNamedGroup()
/* 43:   */   {
/* 44:51 */     return getNode().findChildByType(RegExpTT.PYTHON_NAMED_GROUP) != null;
/* 45:   */   }
/* 46:   */   
/* 47:   */   public boolean isRubyNamedGroup()
/* 48:   */   {
/* 49:55 */     return (getNode().findChildByType(RegExpTT.RUBY_NAMED_GROUP) != null) || (getNode().findChildByType(RegExpTT.RUBY_QUOTED_NAMED_GROUP) != null);
/* 50:   */   }
/* 51:   */   
/* 52:   */   public String getGroupName()
/* 53:   */   {
/* 54:60 */     if (!isPythonNamedGroup()) {
/* 55:61 */       return null;
/* 56:   */     }
/* 57:63 */     ASTNode localASTNode = getNode().findChildByType(RegExpTT.NAME);
/* 58:64 */     return localASTNode != null ? localASTNode.getText() : null;
/* 59:   */   }
/* 60:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.lang.regexp.psi.impl.RegExpGroupImpl

 * JD-Core Version:    0.7.0.1

 */